﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace QLDL
{
    public partial class frmMain : Form
    {
        lib tv = new lib();
        bool luu;
        int id;
        //DataTable tb = new DataTable();
        public frmMain()
        {
            InitializeComponent();
        }

        private void frmMain_Load(object sender, EventArgs e)
        {
            disableMenu();
            foreach (Form f in MdiChildren)
            {
                f.Close();
            }
            frmLogin f1 = new frmLogin();
            f1.Location = new Point(100, 100);
            //f1.DesktopLocation = new Point(100, 100);
            f1.MdiParent = this;
            //f1.WindowState = FormWindowState.Maximized;
            f1.Show();
        }

        public void disableMenu()
        {
            mnuHtdn.Enabled = true;
            mnuHtdx.Enabled = false;
            mnuHtqlnd.Enabled = false;
            mnuBM.Enabled = false;
            mnuQl.Enabled = false;
            mnuBCTK.Enabled = false;
            mnuDm.Enabled = false;
        }
        public void enableMenu()
        {
            mnuHtdn.Enabled = false;
            mnuHtdx.Enabled = true;
            mnuHtqlnd.Enabled = true;
            mnuBM.Enabled = true;
            mnuQl.Enabled = true;
            mnuBCTK.Enabled = true;         
            mnuDm.Enabled = true;
        }

        public void adminenableMenu()
        {
            mnuHtqlnd.Enabled = true;
        }
        public void admindisenableMenu()
        {
            mnuHtqlnd.Enabled = false;
            mnuQl.Enabled = false;
            mnuBM.Enabled = false;
            mnuBCTK.Enabled = false;
        }

        private void đĂNGNHẬPToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form f in MdiChildren)
            {
                f.Close();
            }
            frmLogin f1 = new frmLogin();
            f1.MdiParent = this;
            f1.Show();
        }
    }
}
